import type { Meta, StoryObj } from '@storybook/vue3-vite';

import { fn } from 'storybook/test';

import MarkdownItViewer from './index.vue';

const meta = {
  title: 'text/MarkdownItViewer',
  component: MarkdownItViewer,
  tags: ['autodocs'],
  argTypes: {
    content: {
      control: 'text',
      description: 'The markdown content to be rendered by the viewer.'
    },
    inline: {
      control: 'boolean',
      description: 'Whether to render the markdown content inline.'
    },
    linkify: {
      control: 'boolean',
      description: 'Whether to automatically convert URLs into clickable links.'
    }
  },
  args: {
    content: '# Hello World\nThis is a **Markdown** viewer component.[Example](https://example.com)',
    linkify: true,
    inline: false
  }
} satisfies Meta<typeof MarkdownItViewer>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Basic: Story = {
  name: 'Basic Usage',
  args: {
    ...meta.args,
  },
};

export const ContentWithLang: Story = {
  name: '包含代码块',
  args: {
    content: 'this is a block code\n```ts\nconst a: number = 1;\n```',
  },
};
